<!--
 * @Description:业务table
 * @Version: 2.0
 * @Autor: kafei
 * @Date: 2021-11-29 16:11:50
 * @LastEditors: kafei
 * @LastEditTime: 2021-12-03 12:01:24
-->
<template>
  <div class="bussinessTable z-w-100">
    <div class="bussinessTable__baseTable">
      <baseTable
        :column-data="columnData"
        :table-data="tableData"
      >
        <template
          v-for="item in cIsTemplate"
          :slot="item.props"
          slot-scope="{data}"
        >
          <slot
            :name="item.props"
            :row="data.row"
          />
        </template>
      </baseTable>
    </div>
    <pagination
      :total="pagination.total"
      :limit="pagination.size"
      :page="pagination.page"
      @pagination="paginationFun"
    />
  </div>
</template>

<script>
import baseTable from '@/components/baseTable/index.vue'
import pagination from '@/components/pagination/index.vue'
export default {
  name: 'BussinessTable',
  components: {
    baseTable,
    pagination
  },
  props: {
    pagination: {
      type: Object,
      default: () => {
        return {}
      }
    },
    columnData: {
      type: Array,
      default: () => {
        return []
      }
    },
    tableData: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  computed: {
    cIsTemplate () {
      return this.columnData.filter(v => v.isTemplate)
    }
  },
  methods: {
    paginationFun ({ page, limit }) {
      // console.log(page, limit)
      this.$emit('pagination', { page, limit })
    },
    getPagination () {
      return this.pagination
    }
  }
}
</script>

<style>

</style>
